package gentle.mapper;

import gentle.entity.User;
import gentle.entity.UserExample;

import java.util.List;

import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.Mapper;

public interface UserMapper extends Mapper<User> {

    @Insert(" insert into user (account, salt, password, " +
            "      roleid, role_name, nickname, " +
            "      sex, birthday )" +
            "    values (#{account,jdbcType=VARCHAR}, #{salt,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, " +
            "      #{roleid,jdbcType=BIGINT}, #{roleName,jdbcType=VARCHAR}, #{nickname,jdbcType=VARCHAR}, " +
            "      #{sex,jdbcType=BIT}, #{birthday,jdbcType=TIMESTAMP})")
    int insert(User user);

    int insertSelective(User user);

    int updateByPrimaryKeySelective(User record);

    @Update("update user set account=#{user.account,jdbcType=VARCHAR},sex =#{user.sex,jdbcType=VARCHAR}, nickname=#{user.nickname,jdbcType=VARCHAR} where id=#{user.id,jdbcType=VARCHAR}")
    int updateByPrimaryKey(@Param("user") User user);
}